#include"http.h"

int HandlHttp::handle(const char * buffer,ssize_t len,int client_fd){
    cout<<"Receive from client"<<": "<<buffer<<endl;

    //这里的读事件实际上是指客户端发来的请求，可能是一个URL，也可能是其他请求信息
    //我们服务器要实现对对应信息的处理
    //这里指简单回复一个http头，便于测试
    const char* response = 
      "HTTP/1.1 200 OK\r\n"
      "Server: VerySimpleServer\r\n"
      "Content-Type: text/plain; charset=UTF-8\r\n"
      "Connection: keep-alive\r\n"
      "Content-Length: 10\r\n"
      "\r\n"
      "0123456789";  // 10字节内容
    send(client_fd, response, strlen(response), 0);
}